using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class PaymentMap : EntityTypeConfiguration<Payment>
	{
		public PaymentMap()
		{
			// Primary Key
			this.HasKey(t => t.PaymentTypeID);

			// Properties
			this.Property(t => t.PaymentTypeID)
				.IsRequired()
				.IsFixedLength()
				.HasMaxLength(2);
				
			this.Property(t => t.PaymentType)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.Intro)
				.HasMaxLength(500);
				
			// Table & Column Mappings
			this.ToTable("Payments");
			this.Property(t => t.PaymentTypeID).HasColumnName("PaymentTypeID");
			this.Property(t => t.PaymentType).HasColumnName("PaymentType");
			this.Property(t => t.Intro).HasColumnName("Intro");
			this.Property(t => t.IsNetPay).HasColumnName("IsNetPay");
			this.Property(t => t.IsForCustomer).HasColumnName("IsForCustomer");
			this.Property(t => t.CanReturn).HasColumnName("CanReturn");
			this.Property(t => t.ReturnOrder).HasColumnName("ReturnOrder");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
		}
	}
}

